Skip to contentSkip to conversation

Change in openvpn[master]: clean up environment variable handling in verify_user_pass_script

Openvpn-devel Superseded plaisthos (Code Review) 2 participants 8 messages Oct 29, 2025 – Nov 12, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1761743833000.I6c502508026c6b85bb092ada4d16d985b20dd41f@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email

to review the following change.

Change subject: clean up environment variable handling in verify_user_pass_script
......................................................................

clean up environment variable handling in verify_user_pass_script

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Found-by ZeroPath (https://zeropath.com/)
Change-Id I6c502508026c6b85bb092ada4d16d985b20dd41f

---
M src/openvpn/ssl_verify.c

1 file changed, 6 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/1326/1

src/openvpn/ssl_verify.c +6 -5
index 04ef27e..993d22c 100644
@@ -1329,7 +1329,7 @@
     }
     else
     {
-        setenv_str(session->opt->es, "username", up->username);
+        /* username env is already set by set_verify_user_pass_env */
         setenv_str(session->opt->es, "password", up->password);
     }
 
@@ -1377,10 +1377,6 @@
         /* purge auth control filename (and file itself) for non-deferred returns */
         key_state_rm_auth_control_files(&ks->script_auth);
     }
-    if (!session->opt->auth_user_pass_verify_script_via_file)
-    {
-        setenv_del(session->opt->es, "password");
-    }
 
 done:
     if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@
     }
 
 error:
+    if (!session->opt->auth_user_pass_verify_script_via_file)
+    {
+        setenv_del(session->opt->es, "password");
+    }
+
     argv_free(&argv);
     gc_free(&gc);
     return retval;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email )

Change subject: clean up environment variable handling in verify_user_pass_script
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 30 Oct 2025 19:43:48 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 clean up environment variable handling in verify_user_pass_script

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Found-by ZeroPath (https://zeropath.com/)
Change-Id I6c502508026c6b85bb092ada4d16d985b20dd41f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
This mail reflects revision 1 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/ssl_verify.c +6 -5
index 04ef27e..993d22c 100644
@@ -1329,7 +1329,7 @@
     }
     else
     {
-        setenv_str(session->opt->es, "username", up->username);
+        /* username env is already set by set_verify_user_pass_env */
         setenv_str(session->opt->es, "password", up->password);
     }
 
@@ -1377,10 +1377,6 @@
         /* purge auth control filename (and file itself) for non-deferred returns */
         key_state_rm_auth_control_files(&ks->script_auth);
     }
-    if (!session->opt->auth_user_pass_verify_script_via_file)
-    {
-        setenv_del(session->opt->es, "password");
-    }
 
 done:
     if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@
     }
 
 error:
+    if (!session->opt->auth_user_pass_verify_script_via_file)
+    {
+        setenv_del(session->opt->es, "password");
+    }
+
     argv_free(&argv);
     gc_free(&gc);
     return retval;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: clean up environment variable handling in verify_user_pass_script

Stared at the code (verified the claims about "username is already exported"), and ran this through the t_server tests which do need a working script/plugin env. Works.

Your patch has been applied to the master branch.

commit 3fbba254b8645d2d1241e59f6ebd05e85ce05b52

Author: Arne Schwabe
Date:   Thu Oct 30 20:43:56 2025 +0100
     clean up environment variable handling in verify_user_pass_script

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34069.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: clean up environment variable handling in verify_user_pass_script
......................................................................

clean up environment variable handling in verify_user_pass_script

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Found-by ZeroPath (https://zeropath.com/)
Change-Id I6c502508026c6b85bb092ada4d16d985b20dd41f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34069.html

---
M src/openvpn/ssl_verify.c

1 file changed, 6 insertions(+), 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/1326/2

src/openvpn/ssl_verify.c +6 -5
index 04ef27e..993d22c 100644
@@ -1329,7 +1329,7 @@
     }
     else
     {
-        setenv_str(session->opt->es, "username", up->username);
+        /* username env is already set by set_verify_user_pass_env */
         setenv_str(session->opt->es, "password", up->password);
     }
 
@@ -1377,10 +1377,6 @@
         /* purge auth control filename (and file itself) for non-deferred returns */
         key_state_rm_auth_control_files(&ks->script_auth);
     }
-    if (!session->opt->auth_user_pass_verify_script_via_file)
-    {
-        setenv_del(session->opt->es, "password");
-    }
 
 done:
     if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@
     }
 
 error:
+    if (!session->opt->auth_user_pass_verify_script_via_file)
+    {
+        setenv_del(session->opt->es, "password");
+    }
+
     argv_free(&argv);
     gc_free(&gc);
     return retval;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email )

Change subject: clean up environment variable handling in verify_user_pass_script
......................................................................

clean up environment variable handling in verify_user_pass_script

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Found-by ZeroPath (https://zeropath.com/)
Change-Id I6c502508026c6b85bb092ada4d16d985b20dd41f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34069.html

---
M src/openvpn/ssl_verify.c

1 file changed, 6 insertions(+), 5 deletions(-)
src/openvpn/ssl_verify.c +6 -5
index 04ef27e..993d22c 100644
@@ -1329,7 +1329,7 @@
     }
     else
     {
-        setenv_str(session->opt->es, "username", up->username);
+        /* username env is already set by set_verify_user_pass_env */
         setenv_str(session->opt->es, "password", up->password);
     }
 
@@ -1377,10 +1377,6 @@
         /* purge auth control filename (and file itself) for non-deferred returns */
         key_state_rm_auth_control_files(&ks->script_auth);
     }
-    if (!session->opt->auth_user_pass_verify_script_via_file)
-    {
-        setenv_del(session->opt->es, "password");
-    }
 
 done:
     if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@
     }
 
 error:
+    if (!session->opt->auth_user_pass_verify_script_via_file)
+    {
+        setenv_del(session->opt->es, "password");
+    }
+
     argv_free(&argv);
     gc_free(&gc);
     return retval;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw

PATCH v2 1/1 clean up environment variable handling in verify_user_pass_script

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Found-by ZeroPath (https://zeropath.com/)
Change-Id I6c502508026c6b85bb092ada4d16d985b20dd41f

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34069.html

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):

src/openvpn/ssl_verify.c +6 -5
index 04ef27e..993d22c 100644
@@ -1329,7 +1329,7 @@
     }
     else
     {
-        setenv_str(session->opt->es, "username", up->username);
+        /* username env is already set by set_verify_user_pass_env */
         setenv_str(session->opt->es, "password", up->password);
     }
 
@@ -1377,10 +1377,6 @@
         /* purge auth control filename (and file itself) for non-deferred returns */
         key_state_rm_auth_control_files(&ks->script_auth);
     }
-    if (!session->opt->auth_user_pass_verify_script_via_file)
-    {
-        setenv_del(session->opt->es, "password");
-    }
 
 done:
     if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@
     }
 
 error:
+    if (!session->opt->auth_user_pass_verify_script_via_file)
+    {
+        setenv_del(session->opt->es, "password");
+    }
+
     argv_free(&argv);
     gc_free(&gc);
     return retval;
#8 lore raw

Re: [Openvpn-devel] [PATCH v2] clean up environment variable handling in verify_user_pass_script

Hi,

Quoted 8 lines · Gert Doering

From: Arne Schwabe <[email protected]...>

The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up.

Also ensure that the password is clean from the env even in an error case.

Resend by mistake, has long been merged. Sorry for the noise.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...